home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1998 August / PC Plus SuperCD 50a Issue 142 (CD142a) (August 1998).iso / trial / demon / TURNPIKE.1 / CLASSES.ZIP / JAVA / AWT / Frame.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-04-14  |  3.0 KB  |  169 lines

  1. package java.awt;
  2.  
  3. import java.awt.peer.FramePeer;
  4.  
  5. public class Frame extends Window implements MenuContainer {
  6.    public static final int DEFAULT_CURSOR = 0;
  7.    public static final int CROSSHAIR_CURSOR = 1;
  8.    public static final int TEXT_CURSOR = 2;
  9.    public static final int WAIT_CURSOR = 3;
  10.    public static final int SW_RESIZE_CURSOR = 4;
  11.    public static final int SE_RESIZE_CURSOR = 5;
  12.    public static final int NW_RESIZE_CURSOR = 6;
  13.    public static final int NE_RESIZE_CURSOR = 7;
  14.    public static final int N_RESIZE_CURSOR = 8;
  15.    public static final int S_RESIZE_CURSOR = 9;
  16.    public static final int W_RESIZE_CURSOR = 10;
  17.    public static final int E_RESIZE_CURSOR = 11;
  18.    public static final int HAND_CURSOR = 12;
  19.    public static final int MOVE_CURSOR = 13;
  20.    String title;
  21.    Image icon;
  22.    MenuBar menuBar;
  23.    boolean resizable;
  24.    Image cursorImage;
  25.    int cursorType;
  26.    Color cursorFg;
  27.    Color cursorBg;
  28.  
  29.    public Frame() {
  30.       this.title = "Untitled";
  31.       this.resizable = true;
  32.       super.visible = false;
  33.       ((Container)this).setLayout(new BorderLayout());
  34.    }
  35.  
  36.    public Frame(String var1) {
  37.       this();
  38.       this.title = var1;
  39.    }
  40.  
  41.    public synchronized void addNotify() {
  42.       super.peer = ((Window)this).getToolkit().createFrame(this);
  43.       if (this.menuBar != null) {
  44.          this.menuBar.addNotify();
  45.          ((FramePeer)super.peer).setMenuBar(this.menuBar);
  46.       }
  47.  
  48.       super.addNotify();
  49.    }
  50.  
  51.    public String getTitle() {
  52.       return this.title;
  53.    }
  54.  
  55.    public void setTitle(String var1) {
  56.       this.title = var1;
  57.       FramePeer var2 = (FramePeer)super.peer;
  58.       if (var2 != null) {
  59.          var2.setTitle(var1);
  60.       }
  61.  
  62.    }
  63.  
  64.    public Image getIconImage() {
  65.       return this.icon;
  66.    }
  67.  
  68.    public void setIconImage(Image var1) {
  69.       this.icon = var1;
  70.       FramePeer var2 = (FramePeer)super.peer;
  71.       if (var2 != null) {
  72.          var2.setIconImage(var1);
  73.       }
  74.  
  75.    }
  76.  
  77.    public MenuBar getMenuBar() {
  78.       return this.menuBar;
  79.    }
  80.  
  81.    public synchronized void setMenuBar(MenuBar var1) {
  82.       if (this.menuBar != var1) {
  83.          if (var1 != null && var1.parent != null) {
  84.             var1.parent.remove(var1);
  85.          }
  86.  
  87.          if (this.menuBar != null) {
  88.             this.remove(this.menuBar);
  89.          }
  90.  
  91.          this.menuBar = var1;
  92.          if (this.menuBar != null) {
  93.             this.menuBar.parent = this;
  94.             FramePeer var2 = (FramePeer)super.peer;
  95.             if (var2 != null) {
  96.                this.menuBar.addNotify();
  97.                var2.setMenuBar(this.menuBar);
  98.             }
  99.          }
  100.  
  101.       }
  102.    }
  103.  
  104.    public synchronized void remove(MenuComponent var1) {
  105.       if (var1 == this.menuBar) {
  106.          FramePeer var2 = (FramePeer)super.peer;
  107.          if (var2 != null) {
  108.             this.menuBar.removeNotify();
  109.             this.menuBar.parent = null;
  110.             var2.setMenuBar((MenuBar)null);
  111.          }
  112.  
  113.          this.menuBar = null;
  114.       }
  115.  
  116.    }
  117.  
  118.    public synchronized void dispose() {
  119.       if (this.menuBar != null) {
  120.          this.remove(this.menuBar);
  121.          this.menuBar = null;
  122.       }
  123.  
  124.       super.dispose();
  125.    }
  126.  
  127.    public boolean isResizable() {
  128.       return this.resizable;
  129.    }
  130.  
  131.    public void setResizable(boolean var1) {
  132.       this.resizable = var1;
  133.       FramePeer var2 = (FramePeer)super.peer;
  134.       if (var2 != null) {
  135.          var2.setResizable(var1);
  136.       }
  137.  
  138.    }
  139.  
  140.    public void setCursor(int var1) {
  141.       if (var1 >= 0 && var1 <= 13) {
  142.          this.cursorType = var1;
  143.          if (super.peer != null) {
  144.             ((FramePeer)super.peer).setCursor(var1);
  145.          }
  146.  
  147.       } else {
  148.          throw new IllegalArgumentException("illegal cursor type");
  149.       }
  150.    }
  151.  
  152.    public int getCursorType() {
  153.       return this.cursorType;
  154.    }
  155.  
  156.    protected String paramString() {
  157.       String var1 = super.paramString();
  158.       if (this.resizable) {
  159.          var1 = var1 + ",resizable";
  160.       }
  161.  
  162.       if (this.title != null) {
  163.          var1 = var1 + ",title=" + this.title;
  164.       }
  165.  
  166.       return var1;
  167.    }
  168. }
  169.